package com.symone.crawler.util;

import cn.hutool.db.Db;
import cn.hutool.db.Entity;

import java.sql.SQLException;
import java.util.Date;

public class DBUtil {

    public static void save(Entity data , Entity whereEntity) throws SQLException {
        if (Db.use().count(whereEntity) == 0) {
            Db.use().insert(data);
        }else{
            data.set("update_time", new Date());
            Db.use().update(data, whereEntity);
        }
    }
}
